home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / monitory / amyload / openloadwindow.c < prev    next >
C/C++ Source or Header  |  1987-11-15  |  2KB  |  70 lines

  1. #include    <intuition/intuition.h>
  2. #include    <devices/load.h>
  3. #include    "execdef.h"
  4. #include    "intuidef.h"
  5. #include    "windownode.h"
  6. #include    "windowinfo.h"
  7.  
  8. #include    "OpenLoadWindow.proto"
  9.  
  10. #include    <intuition/proto.h>
  11. #include    <exec/proto.h>
  12. #include    <graphics/proto.h>
  13.  
  14. #include    "SetWindowInfo.proto"
  15. #include    "PrintMessage.proto"
  16.  
  17. extern MsgPort *windowPort;
  18. extern MinList windowList;
  19.  
  20. static ULONG IDCMPFlags = MOUSEBUTTONS | CLOSEWINDOW | NEWSIZE | REFRESHWINDOW;
  21. static char  *myname =     "Amyload by";
  22. static char  *myauthor = "Jeff Kelley";
  23.  
  24. WindowNode *
  25. OpenLoadWindow(new_window, back_pen_num)
  26.     NewWindow *new_window;
  27.     unsigned char back_pen_num;
  28. {
  29.     WindowNode *windownode;
  30.     Window *window;
  31.     WindowInfo *window_info;
  32.     Gadget *gadget;
  33.  
  34.     if (!(windownode = (WindowNode *)AllocMem(sizeof(WindowNode), 0)))
  35.     return NULL;
  36.     if (!(window = OpenWindow(new_window)))
  37.     {
  38.     FreeMem((char *)windownode, sizeof(WindowNode));
  39.     return NULL;
  40.     }
  41.     windownode->window = window;
  42.     if (!(window_info = (WindowInfo *)AllocMem(sizeof(WindowInfo), 0)))
  43.     {
  44.     FreeMem((char *)windownode, sizeof(WindowNode));
  45.     CloseWindow(window);
  46.     return NULL;
  47.     }
  48.     window->UserData = (char *)window_info;
  49.     NewList(&window_info->loadrecords);
  50.     SetWindowInfo(window);
  51.     window_info->back_pen_num = back_pen_num;
  52.     for (gadget = window->FirstGadget; gadget; gadget = gadget->NextGadget)
  53.     {
  54.     gadget->GadgetRender = NULL;
  55.     gadget->SelectRender = NULL;
  56.     }
  57.     RefreshWindowFrame(window);
  58.     SetAPen(window->RPort, back_pen_num);
  59.     RectFill(window->RPort, window_info->leftedge,
  60.                 window_info->topedge,
  61.                 window_info->rightedge,
  62.                 window_info->bottomedge);
  63.     PrintMessage(window, myname, (short)1, (unsigned char)1);
  64.     PrintMessage(window, myauthor, (short)2, (unsigned char)3);
  65.     window->UserPort = windowPort;
  66.     ModifyIDCMP(window, IDCMPFlags);
  67.     AddTail(&windowList, &windownode->node);
  68.     return windownode;
  69. }
  70.